package edu.java.lectures.lec03.design.patterns;

import java.awt.Color;

public class Car {

    // --- Constants -----------------------------------------------------------

    public static final int MIN_WEELS_NUMBER = 3;
    public static final int MIN_RESERVOIR_VOLUME = 10;

    // --- Instant Variables ---------------------------------------------------

    private long factoryId;
    private int weelsNumber;
    private Color color;
    private double reservoirVolume;

    // --- Constructors --------------------------------------------------------

    public Car() {
    }

    public Car(long factoryId, int weelsNumber, Color color,
	    double reservoirVolume) {
	// !!!!!!! hard parameter verification
	// if (weelsNumber < 0) {
	// }
	this.factoryId = factoryId;
	this.weelsNumber = weelsNumber;
	this.color = color;
	this.reservoirVolume = reservoirVolume;
    }

    // --- Methods -------------------------------------------------------------

    public long getFactoryId() {
	return factoryId;
    }

    void setFactoryId(long factoryId) {
	if (factoryId <= 0) {
	    throw new IllegalArgumentException();
	}
	this.factoryId = factoryId;
    }

    public int getWeelsNumber() {
	return weelsNumber;
    }

    public void setWeelsNumber(int weelsNumber) {
	if (weelsNumber < MIN_WEELS_NUMBER) {
	    // throw
	    throw new IllegalArgumentException();
	}
	this.weelsNumber = weelsNumber;
    }

    public Color getColor() {
	return color;
    }

    public void setColor(Color color) {
	if (color == null) {
	    // throw
	    throw new IllegalArgumentException();
	}
	this.color = color;
    }

    public double getReservoirVolume() {
	return reservoirVolume;
    }

    public void setReservoirVolume(double reservoirVolume) {
	if (reservoirVolume < MIN_RESERVOIR_VOLUME) {
	    // throw
	    throw new IllegalArgumentException();
	}
	this.reservoirVolume = reservoirVolume;
    }

}
